package text;
import com.hmall.search.Config.HotelEsSynclistener;
import com.hmall.search.SearchApplication;
import org.apache.http.HttpHost;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.indices.CreateIndexRequest;
import org.elasticsearch.common.xcontent.XContentType;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import static com.hmall.search.Config.HotelEsSynclistener.MAPPING_TEMPLATE;

//@SpringBootTest(classes = SearchApplication.class)
//@RunWith(SpringRunner.class)
//public class creatindex {
//    RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(
//            HttpHost.create("http://localhost:9200")));
//    @Test
//    public void testcreatIndex() throws Exception{
//        CreateIndexRequest request=new CreateIndexRequest("item");
//        request.source(MAPPING_TEMPLATE, XContentType.JSON);
//        client.indices().create(request, RequestOptions.DEFAULT);
//    }
//}
